home *** CD-ROM | disk | FTP | other *** search
/ Champak 128 / Vol 128 (Damaged).iso / games / boiler_b.swf / scripts / frame_119 / DoAction.as
Encoding:
Text File  |  2011-03-26  |  1.1 KB  |  60 lines

  1. function jumpKey()
  2. {
  3.    var _loc1_ = Key.getCode();
  4.    if(_loc1_ == 32 || _loc1_ == 38)
  5.    {
  6.       bod_mc.jump();
  7.    }
  8. }
  9. var pGameOverTimer;
  10. this.onEnterFrame = function()
  11. {
  12.    tx = 0;
  13.    if(Key.isDown(37))
  14.    {
  15.       tx -= 2;
  16.    }
  17.    if(Key.isDown(39))
  18.    {
  19.       tx += 2;
  20.    }
  21.    if(Key.isDown(40))
  22.    {
  23.       tx = 0;
  24.    }
  25.    this.bod_mc.nudge(tx);
  26.    this.camera_mc.render();
  27. };
  28. if(jumpListener != undefined)
  29. {
  30.    Key.removeListener(jumpListener);
  31.    jumpListener = undefined;
  32. }
  33. var jumpListener = new Object();
  34. jumpListener.onKeyDown = jumpKey;
  35. Key.addListener(jumpListener);
  36. this.gameOver = function(tWinLose)
  37. {
  38.    var _loc1_ = this;
  39.    Key.removeListener(jumpListener);
  40.    delete onEnterFrame;
  41.    if(tWinLose == "win")
  42.    {
  43.       _loc1_.snd_mc.win();
  44.       _loc1_.bod_mc.gameComplete();
  45.    }
  46.    else
  47.    {
  48.       _loc1_.snd_mc.lose();
  49.       _loc1_.bod_mc.gameOver();
  50.    }
  51.    pGameOverTimer = setInterval(moveOn,4000);
  52. };
  53. this.moveOn = function()
  54. {
  55.    clearInterval(pGameOverTimer);
  56.    play();
  57. };
  58. snd_mc.playgamemusic();
  59. stop();
  60.